home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_319 / cnewssrc / cnews.orig.lzh / h / news.h < prev    next >
C/C++ Source or Header  |  1989-06-27  |  5KB  |  143 lines

  1. /*
  2.  * definitions unique to all of C news
  3.  * things marked with qqq are subject to being configured by "build"
  4.  */
  5.  
  6. /*
  7.  * tunable parameters
  8.  * which actually very seldom need to be tuned
  9.  * in particular, don't get alarmed about MAXCOMP, it's not used for
  10.  *  anything where it matters
  11.  */
  12. #define MAXPATH 1024        /* max. length of pwd output */
  13. #define MAXCOMP 14        /* file name component length */
  14. #define MAXHOST 128        /* max. length of this host's name */
  15. #define SPOOLTMP ".tmpXXXXXX"    /* template for NEWSARTS temporary link */
  16.  
  17.  
  18. /* STATIC & FORWARD must agree to avoid redeclarations(!) */
  19. #define STATIC    static        /* "static" when not debugging|profiling */
  20.  
  21. /* adapt to compiler limitations */
  22. #ifdef pdp11
  23. #define FORWARD            /* "static" except for dmr's 11 compiler */
  24. #else
  25. #define FORWARD static        /* "static" except for dmr's 11 compiler */
  26. #endif
  27. /* #define void int        /* if your compiler doesn't understand void's */
  28. /* #define MAXLONG 017777777777L    /* if your compiler lacks "unsigned long" type
  29. */
  30.  
  31. /* adapt to library limitations */
  32. #define NOSTOREVAL    /* qqq if your dbm store() returns no value (as in orig. v7)
  33. */
  34.  
  35. /* fundamental constants of the implementation */
  36. #define SMALLMEM    /* qqq for PDP-11s, PDP-8s, IBM PCs, etc. */
  37. #define    FASTINDEX    /* qqq if string functions are very fast */
  38.  
  39. /* automatic configuration */
  40. #ifdef pdp11
  41. #ifndef SMALLMEM
  42. #define SMALLMEM
  43. #endif                /* SMALLMEM */
  44. #endif                /* pdp11 */
  45.  
  46.  
  47. /* types */
  48. typedef short statust;
  49. typedef char boolean;
  50.  
  51. /* status bits */
  52. #define ST_OKAY        0    /* nothing wrong */
  53. #define ST_SHORT    (1<<1)    /* article shorter than byte count; truncated? */
  54. #define ST_ACCESS    (1<<2)    /* no access permission */
  55. #define ST_REFUSED    (1<<3)    /* article was deliberately refused - OK */
  56. #define ST_DROPPED    (1<<4)    /* article was accidentally dropped */
  57. #define ST_DISKFULL    (1<<5)    /* disk full - give up */
  58. #define ST_JUNKED    (1<<6)    /* article was accepted, but junked */
  59.  
  60. /* newsgroup specific definitions */
  61. #define NGSEP ','        /* separates groups */
  62. #define NGNEG '!'        /* preceding a pattern, negates it */
  63. #define NGDELIM '.'        /* within a group */
  64. #define FNDELIM '/'        /* within a group, on disk */
  65. #define SFNDELIM "/"        /* string of FNDELIM */
  66.  
  67. /* macros, replacing functions for speed */
  68. #define max(a,b) ((a) > (b)? (a): (b))
  69. #define min(a,b) ((a) < (b)? (a): (b))
  70. #define iswhite(c) ((c) == ' ' || (c) == '\t')
  71. /* STREQ is an optimised strcmp(a,b)==0 */
  72. #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
  73. /* STREQN is an optimised strncmp(a,b,n)==0; assumes n > 0 */
  74. #define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)
  75. #define STRLEN(s) (sizeof (s) - 1)    /* s must be a char array */
  76. #ifdef FASTINDEX
  77. #define INDEX(src, chr, dest) (dest) = index(src, chr)
  78. extern char *index();
  79. #else
  80. #define INDEX(src, chr, dest) \
  81.     for ((dest) = (src); *(dest) != '\0' && *(dest) != (chr); ++(dest)) \
  82.         ; \
  83.     if (*(dest) == '\0') \
  84.         (dest) = NULL        /* N.B.: missing semi-colon */
  85. #endif
  86.  
  87. /* macros, of necessity */
  88. /* nnafree(any **) where "any" is any type; must be a macro */
  89. #define nnafree(mempp) (*(mempp) != 0? (free((char *)*(mempp)), (*(mempp) = 0))
  90.  0)
  91. #ifdef lint
  92. nnfree(mempp)        /* If *mempp is non-null, free it and zero it. */
  93. register char **mempp;            /* pointer to malloc'ed ptr. */
  94. {
  95.     if (*mempp != 0) {
  96.         free(*mempp);
  97.         *mempp = 0;
  98.     }
  99. }
  100. #else                    /* lint */
  101. #define nnfree nnafree
  102. #endif                    /* lint */
  103.  
  104. #define YES 1
  105. #define NO 0
  106.  
  107. #define NOTALLHDRS NO            /* hdrdump flags for "all headers seen?" */
  108. #define ALLHDRS YES
  109.  
  110. #define DEFEXP "-"            /* default expiry period */
  111.  
  112. /* imports from news */
  113. extern char *progname;
  114.  
  115. extern void fclsexec();                /* from ../libos */
  116. extern FILE *fopenexcl();            /* from ../libos */
  117. extern char *getcwd();                /* from ../libos */
  118.  
  119. extern FILE *fopenclex(), *fopenwclex();    /* from ../libcnews/fopenclex.c */
  120. extern char *gethdr();                /* from ../libcnews/gethdr.c */
  121. extern char *hostname();            /* from ../libcnews/hostname.c */
  122. extern void lockdebug(), newslock(), newsunlock();    /* from ../libcnews/lock.c *
  123.  
  124. extern void errunlock();            /* from ../libcnews/lock.c */
  125. extern int ltozan(), ltoza();            /* from ../libcnews/ltoza.c */
  126. extern void matchdebug();            /* from ../libcnews/ngmatch.c */
  127. extern boolean ngmatch();            /* from ../libcnews/ngmatch.c */
  128. extern void mkfilenm(), trim();            /* from ../libcnews/string.c */
  129. extern boolean anyhostin(), hostin();        /* from ../libcnews/string.c */
  130. extern int hopcount();                /* from ../libcnews/string.c */
  131. extern char *skipsp(), *first(), *strsvto();    /* from ../libcnews/string.c */
  132. extern char *sendersite(), *nullify();        /* from ../libcnews/string.c */
  133. extern char *canonpath();            /* from ../libcnews/string.c */
  134. extern void timestamp();            /* from ../libcnews/time.c */
  135.  
  136. extern void warning(), error();            /* from ../libc */
  137. extern void standard();                /* from ../libc */
  138. extern void closeall();                /* from ../libc */
  139. extern void stdfdopen();            /* from ../libc */
  140. extern int nfclose();                /* from ../libc */
  141.  
  142. #include "alloc.h"                /* ugh */
  143.